<template>
  <div class="box">
    <header class="header">
      <van-nav-bar title="购物车" left-arrow @click-left="$router.back()" />
    </header>
    <main class="content">
      <van-swipe-cell v-for="item in store.cartList" :key="item.id">
  <van-card
    :num="item.count"
    :price="item.price"
    :title="item.title"
    class="goods-card"
    :thumb="item.image"
  />
  <template #right>
    <van-button square text="删除" type="danger" class="delete-button" />
  </template>
</van-swipe-cell>
    </main>
  </div>
  <footer>
    <van-submit-bar :price="3050" button-text="提交订单" @submit="onSubmit">
  <van-checkbox v-model="allChecked">全选</van-checkbox>
  <template #tip>
    你的收货地址不支持配送, <span @click="$router.push('/order')">修改地址</span>
  </template>
</van-submit-bar>
  </footer>
</template>

<script setup>
import { useCounterStore } from '@/stores/counter'
import { computed } from 'vue';
// 可以在组件中的任意位置访问 `store` 变量 ✨
const store = useCounterStore()
// const allChecked=computed({
//   get(){
//     if(store.cartList.value=0){
//       return false
//     }else{
//       store.cartList.every(item=>item.id==id)
//     }
//   },
//   set(newValues){
//     store.cartList.forEach(item=>item.id=newValues)
//   }
// })
</script>

<style lang="scss" scoped>

</style>